<template>
	<view class="content">
		<view class="header">
			<view class="view" v-for="(item,index) in columns" :key="index" @click="inx = index">
				<text :style="{'border-bottom':index == inx ? '3px solid #029CFE' : '3px solid #cdf0fd',
				'color':index == inx ? '#029CFE' : '#4C4C4C'}">{{item.label}}</text>
			</view>
			<u--image :showLoading="true" src="../../static/more.png" width="28rpx" height="28rpx"
				radius="0"></u--image>
		</view>
		<view class="Box">
			<view v-for="(item,index) in lists" :key="index" class="BoxView">
				<view class="BoxOne">
					<u--image :showLoading="true" :src="item.avatar" width="94rpx" height="94rpx"
						radius="0"></u--image>
					<view class="BoxContent">
						<view class="BoxTop marginBottom">
							<text class="title">{{item.name || ''}}</text>
							<text style="color:#888888;margin-left:15rpx;">{{item.country.name || ''}}教师</text>
						</view>
						<view class="BoxTop">
							<text class="Newtitle">{{item.description || ''}}</text>
						</view>
					</view>
				</view>
				<button @click="linkUrl('/pages/Mine/Schedule_courses')">约课</button>
			</view>
		</view>
		<view class="null" v-if="lists.length == 0">
			<u--image :showLoading="true" src="../../static/null.png" width="328rpx" height="328rpx"
				radius="0"></u--image>
		</view>
	</view>
</template>

<script>
	import {collectTeacherList} from '../../api/Teacher.js';
	export default {
		data() {
			return {
				show: false,
				inx:0,
				columns: [{
					label: '全部',
					// 其他属性值
					id: 2021
					// ...
				}, {
					label: '英语',
					id: 804
				},{
					label: '法语',
					id: 804
				}],
				req:{
					shop_id:1,
					page:1,
					limit:10,
				},
				lists:[]
			}
		},
		onLoad(){
			this.collectTeacherList();
		},
		methods:{
			/**
			@method 老师详情
			**/
			async collectTeacherList(id = null) {
				try {
					const res = await collectTeacherList(this.req);
					this.lists = [...res.data.data];
				} catch (err) {
					//TODO handle the exception
					console.log(err);
				}
			},
			linkUrl(e){
				uni.navigateTo({
					url:e
				});
			}
		}
	}
</script>

<style>
	page{
		background-color:#f6f7f9;
	}
</style>
<style scoped lang="scss">
	.content {
		.null{
			width:100%;
			display: flex;
			justify-content: center;
			padding-top:50rpx;
		}
		.header {
			width: auto;
			background-color: #cdf0fd;
			padding: 20rpx 20rpx 0rpx 30rpx;
			display: flex;
			align-items: center;

			.view {
				width: auto;
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-right:160rpx;
				
				text {
					border-bottom:3px solid transparent;
					padding-bottom:20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 600;
					font-size: 28rpx;
				}
			}
			
			/deep/ .u-image{
				margin-top:-25rpx;
			}
		}

		.Box{
			.BoxView{
				width:85%;
				margin:0px auto;
				background-color: #fff;
				border-radius:20rpx;
				padding:30rpx 40rpx 30rpx 40rpx;
				margin-top:20rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
			}
			.BoxOne{
				display: flex;
				justify-content: space-between;
				.marginBottom{
					margin-bottom:10rpx;
				}
				.BoxTop{
					margin-left:20rpx;
					display: flex;
					align-items: center;
					text{
						display: block;
						font-size:24rpx;
					}
					
					.title{
						font-family: PingFangSC, PingFang SC;
						font-weight: 600;
						font-size: 32rpx;
						color: #333333;
						font-style: normal;
					}
					.Newtitle{
						font-family: PingFangSC, PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #333333;
						font-style: normal;
					}
				}
			}
			button{
				width: 154rpx;
				height: 60rpx;
				background: linear-gradient( 270deg, #3078FF 0%, #009DFE 100%);
				border-radius: 46rpx;
				margin:0px;
				display: flex;
				justify-content: center;
				align-items: center;
				color:#fff;
				font-size:26rpx;
			}
		}
		.BoxTime{
			display: flex;
			align-items: center;
			margin-top:20rpx;
			margin-bottom:20rpx;
			view{
				display: flex;
				align-items: center;
				text{
					margin-left:10rpx;
					margin-right:30rpx;
				}
			}
		}
	}
</style>